import { GameContext } from "@sapi-game/gameContext";
import { PlayerGroup } from "@sapi-game/gamePlayer/playerGroup";
import { WereWolfMapData } from "./maps";
import { WereWolfPlayer } from "./player";

export interface WereWolfSetting {
    restrictMode: boolean;
    fullKill: boolean;
}

export class WereWolfContext extends GameContext {
    players: PlayerGroup<WereWolfPlayer>;
    config: WereWolfSetting;
    day: number = 0; //天数
    poison = true; //毒药
    antidote = true; //解药
    winner: "werewolves" | "villagers" | null = null; //胜利方
    map: WereWolfMapData;

    get views() {
        return this.map.phaseViews;
    }

    constructor(
        players: PlayerGroup<WereWolfPlayer>,
        config: { map: WereWolfMapData }
    ) {
        super();
        this.players = players;
        this.config = {
            fullKill: true,
            restrictMode: true,
        };
        this.map = config.map;
    }
}
